<?php
 /*
 * 1626cms 會員登入狀態顯示
 * ============================================================================
 * 版權所有: 1626網絡，并保留所有權利。
 * 網站地址: http://www.1626.com；
 * ----------------------------------------------------------------------------
 * 這不是一個自由軟件！您只能在不用于商業目的的前提下對程序代碼進行修改和
 * 使用；不允許對程序代碼以任何形式任何目的的再發布。
 * ============================================================================
*/
define('IN_QISHI', true);
require_once('../include/common.inc.php');
header("Content-Type: application/x-javascript;charset=utf8");
require_once(QISHI_ROOT_PATH.'include/mysql.class.php');
$db = new mysql($dbhost,$dbuser,$dbpass,$dbname);
unset($dbhost,$dbuser,$dbpass,$dbname);
$smarty->caching = false;
require_once(QISHI_ROOT_PATH.'include/fun_user.php');
if(!$_SESSION['uid'] && !$_SESSION['username'] && !$_SESSION['utype'] && $_COOKIE['Qishi']['username'] && $_COOKIE['Qishi']['password'])
{
if(check_cookie($_COOKIE['Qishi']['username'],$_COOKIE['Qishi']['password']))
{
update_user_info($_COOKIE['Qishi']['username'],false);
}
else
{
setcookie('Qishi[username]',"", time() - 3600,$cookiepath, $cookiedomain);
setcookie('Qishi[password]',"", time() - 3600,$cookiepath, $cookiedomain);
}
}
//判斷登入狀態
/*
if ($_SESSION['uid'] && $_SESSION['username'] && $_SESSION['utype'])
{
$content.="<table border=\"0\" align=\"right\" cellpadding=\"0\" cellspacing=\"0\">";
$content.="<tr>";
$content.="<td class=\"head_logo_right_login_table_left\">&nbsp;</td>";
$content.="<td class=\"head_logo_right_login_table_img\">&nbsp;</td>";
$content.="<td class=\"head_logo_right_login_table_bg link_lan\">歡迎&nbsp;&nbsp;<a href=\"user.php\" style=\"color:#339900\">".$_SESSION['username']."</a>&nbsp;&nbsp; 登入！&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"".url_rewrite('user')."\">[會員中心]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"".url_rewrite('user')."?act=logout\" >[登出]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>";
$content.="<td class=\"head_logo_right_login_table_right\">&nbsp;</td>";
$content.="</tr>";
$content.="</table>";
echo "document.writeln('".$content."');";
}
else
{
$content.="<table border=\"0\" align=\"right\" cellpadding=\"0\" cellspacing=\"0\">";
$content.="<tr>";
$content.="<td class=\"head_logo_right_login_table_left\">&nbsp;</td>";
$content.="<td class=\"head_logo_right_login_table_img\">&nbsp;</td>";
$content.="<td class=\"head_logo_right_login_table_bg link_lan\">歡迎登入".$_CFG['site_name']."！&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"".url_rewrite('user')."\" >[登入]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"".url_rewrite('user')."?act=reg1\" >[免費注冊]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>";
$content.="<td class=\"head_logo_right_login_table_right\">&nbsp;</td>";
$content.="</tr>";
$content.="</table>";
echo "document.writeln('".$content."');";
}
*/
//判斷登入狀態
if ($_SESSION['uid'] && $_SESSION['username'] && $_SESSION['utype'])
{
	if( $_SESSION['utype'] == 2){
		$content.="<span class=\"userbox\">歡迎&nbsp;&nbsp;<a href=\"user.php\" class=\"navlink\">".$_SESSION['username']."</a>，<a href=\"".url_rewrite('user')."\"  class=\"navlink\">[職位申請表格]</a>&nbsp;&nbsp;&nbsp;<a href=\"".url_rewrite('user')."?act=logout\" >[登出]</a></span>";
	}else
	{
		$content.="<span class=\"userbox\">歡迎&nbsp;&nbsp;<a href=\"user.php\" class=\"navlink\">".$_SESSION['username']."</a>，<a href=\"".url_rewrite('user')."\"  class=\"navlink\">[顧主管理]</a>&nbsp;&nbsp;&nbsp;<a href=\"".url_rewrite('user')."?act=logout\" >[登出]</a></span>";		
	}
echo "document.writeln('".$content."');";
}
else
{
$content.="<span class=\"userbox\">歡迎光臨&nbsp;&nbsp;<a href=\"".url_rewrite('user')."\" class=\"navlink\">[请登入]</a>,<a href=\"".url_rewrite('user')."?act=reg1\"  class=\"navlink\">[免費注冊]</a></span>";
echo "document.writeln('".$content."');";
}
?>
